
const loadingHOC = (Wrapped,getData) => {
    return {
        name: 'LoadingHOC',
        data(){
            return {
                loading: false,
                result: null
            }
        },
        async mounted(){
            this.loading = true
            try {
                this.result = await getData()
            } catch (error) {
                
            }finally {
                this.loading = false
            }
        },
        render(h){
            return (
                <Wrapped loading={this.loading} result={this.result}/>
            )
        }
    }
}

export default loadingHOC